<?php include_once 'layout/heard.php'?>
<body style="background:#f5f5f5;">

<div class="content head_bg">
	<div class="head">
    	<a href="javascript:void(0)" class="return_ico" onclick="javascript:history.go(-1);"><span></span></a>
        <h1>我的钱包</h1>
    </div>
</div>

<?php
function getthemonth($date)
{
    $firstday = date('Y-m-01', strtotime($date));
    $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
    return array($firstday,$lastday);
}
$today = date("Y-m-d");
$day = getthemonth($today);
?>
<div class="wdqb_top">
	<div class="content">
    	<div class="text">
        	<p><span>本月收入</span>(元)</p>
        	<h3 id="h3"><?php echo $money?></h3>
        </div>
        <div class="box">
            <span>时间：</span>
            <div id="birthday" data-options='{"type":"date","beginYear":2010,"endYear":2050}' class="btn qsrz_text_bnt" style="width: 90px;height: 25px;"><?php echo isset($startdt)?$startdt:'';?></div>
            <label>-</label>
            <div id="birthday2" data-options='{"type":"date","beginYear":2019,"endYear":2050}' class="btn2 qsrz_text_bnt" style="width: 90px;height: 25px;"><?php echo isset($enddt)?$enddt:'';?></div>
            <a class="a_bnt_cx" href="#">查询</a>
        </div>
    </div>    
</div>

<div class="content" style="background:none;">
    <div class="wdqb_xx">
		<ul id="moneyList">
            <?php
            if($data){
            foreach($data as $v){
                echo '<p>收入：<span>￥ '.$v['express_fee'].'</span></p>
                <p>配货单号：'.$v['ph_no'].'</p>
                <p>送达时间：'.$v['updatedt'].'</p>';
            }
            }
            ?>
        </ul>	
    </div>
</div>

<link href="webroot/riders/css/mui.picker.min.css" rel="stylesheet" type="text/css">
<script src="webroot/riders/js/mui.min.js"></script>
<script src="webroot/riders/js/mui.picker.min.js"></script>

<script>

    jQuery(".a_bnt_cx").click(function () {
        var startdt = jQuery("#birthday").text();
        var enddt = jQuery("#birthday2").text();
        var res = '';
        jQuery.ajax({
            url:"?md=riders&cl=riders&at=getMyWallet",
            dataType:"json",
            data:{'startdt':startdt,'enddt':enddt},
            type:"post",
            success:function (d) {
                if(d.status == 1){
                    var res = '';
                    jQuery("#moneyList").html('');
                    jQuery("#h3").html('');
                    $(d.result).each(function (k,v) {
                        res += '<span>￥ '+v.express_fee+'</span></p><p>配货单号： '+v.ph_no+'</p><p>送达时间： '+v.updatedt+'</p>';
                    });
                    jQuery("#h3").html(d.moneys);
                    jQuery("#moneyList").html(res);
                }else{
                    jQuery("#h3").html('');
                    jQuery("#moneyList").html('');
                    alert(d.msg);
                }
            }
        });
    });

</script>
<script>
	(function($) {
		$.init();
		var result = $('#birthday')[0];
		var btns = $('.btn');
		btns.each(function(i, btn) {
			btn.addEventListener('tap', function() {
				var optionsJson = this.getAttribute('data-options') || '{}';
				var options = JSON.parse(optionsJson);
				var id = this.getAttribute('id');
				var picker = new $.DtPicker(options);
				picker.show(function(rs) {
					result.innerText = rs.text;
					picker.dispose();
				});
			}, false);
		});
	})(mui);
</script>
<script>
	(function($) {
		$.init();
		var result = $('#birthday2')[0];
		var btns = $('.btn2');
		btns.each(function(i, btn) {
			btn.addEventListener('tap', function() {
				var optionsJson = this.getAttribute('data-options') || '{}';
				var options = JSON.parse(optionsJson);
				var id = this.getAttribute('id');
				var picker = new $.DtPicker(options);
				picker.show(function(rs) {
					result.innerText = rs.text;
					picker.dispose();
				});
			}, false);
		});
	})(mui);
</script>
<?php include_once 'layout/rfooter.php'?>



